<?php
/*
Redis
*/

class RPHP_Db_Redis
{
    
    protected $redis = null;

    public function __construct($params){
        $this->redis = new redis;
        $this->redis->connect($params['host'],$params['port']);
    }

    public function ping()
    {
        return $this->redis->ping();
    }

    public function close()
    {
        return $this->redis->close();
    }

    public function del($key)
    {
        return $this->redis->del($key);
    }

/*String data*/

    public function get($key)
    {
        return $this->redis->get($key);
    }

    public function set($key,$value)
    {
        return $this->redis->set($key,$value);
    }

    public function setex($key,$exp,$value)
    {
        return $this->redis->setex($key,$exp,$value);
    }


    

/*Sorted Set*/

    public function zadd($key,$score,$value)
    {
        return $this->redis->zadd($key,$score,$value);
    }

    public function zrange($key,$start=0,$stop=-1,$withscores = false)
    {
        return $this->redis->zrange($key,$start,$stop,$withscores);
    }

    public function zcard($key)
    {
        return $this->redis->zcard($key);
    }

    public function zremrangebyscore($key,$min,$max)
    {
        return $this->redis->zremrangebyscore($key,$min,$max);
    }
}